<template>
  <div class="feedback">
    <x-header title="意见反馈" :left-options="{backText:''}" class='whiteHeader'></x-header>
    <div class="yourSuggestion">
    		<input type="text" placeholder="请输入您的意见" v-model="yourSuggestion"/>
    </div>
    <div class="yourContact">
    		<input type="text" placeholder="请输入您的手机号/QQ号/微信号" v-model="yourContact"/>
    </div>
    <div class="feedbackBlank"></div>
    <button @click="submit">提交</button>
  </div>
</template>
<script>
/*意见反馈*/
import {XHeader,Alert} from 'vux';
import { setCookie, getCookie } from '../../util/commonUtils';
export default {
  name:"feedback",
  // 数据
  data(){

    return{
    	userId:'',
    	yourSuggestion:'',//意见
    	yourContact:'',//联系方式
    }
  },
  // 计算属性
  computed:{

  },
  // 创建（实例创建完成）
  created(){
    this.userId=getCookie('loginkey');
    
  },
  // el被创建，并挂载到实例上
  mounted(){

  },
  // 方法（实例中的方法）-----------
  methods:{
    	//提交
    	submit(){
    		 if(this.yourSuggestion == '' || this.yourSuggestion == null){
    		 		this.$vux.alert.show({title:'提示',content:'请输入您的意见!'});return;
    		 }
    		 if(this.yourContact == '' || this.yourContact == null){
    		 		this.$vux.alert.show({title:'提示',content:'请输入您的联系方式!'});return;
    		 }
    		 //意见反馈
    		 let obj = {};
    		 obj.USER_ID = this.userId;
    		 obj.CONTENT = this.yourSuggestion;
    		 obj.EMAIL = this.yourContact;        		 
		    this.$fetchPost('/SystemSetWeb/addFeedback.action',obj).then(res=>{    
		    				//console.dir(res);
		            if(res.STATUS_CODE == 1){
		            	    this.$vux.alert.show({title:'提示',content:'提交成功!'});   
		            	    setTimeout(()=>this.$router.push('/mine'),1000);
		            }                                 
		    },err=>console.log(err));
    	},
  },
  // 子组件
  components:{
    XHeader,
    Alert
  }
}
</script>
<!--当前页面的样式 -->
<style lang="less" scoped>
.feedback{
	min-height:100%;
	background:#f0eff5;
  	.yourSuggestion{
  		background:#fff;
  		height:3.4rem;
  		display:flex;
  		justify-content:center;  		 		
  		input{
  			border:0;  			
  			align-self:center;
  			width:7.18rem;
  			height:3rem;
  			line-height:3rem;
  			background:#ededed;
  			border-radius:0.12rem;     			   					  				
  		}
  		input:focus{  			
  			text-indent:0.12rem;
  			line-height:0.26rem;
  		}
  		input::placeholder{   		 		  	  					  			  			  			 		
  			text-align:left;  			  					  		  			
  			text-indent:0.12rem;   			 			
  			font-size:0.28rem;
  			color:#808080;
  		}
  	}
  	.yourContact{
  		background:#fff;
  		height:0.78rem;
  		display:flex;
  		justify-content:center;
  		input{
  			border:0;
  			align-self:center;
  			width:7.18rem;
  			line-height:0.78rem;
  			height:100%;
  			background:#ededed;
  			border-radius:0.04rem;  			
  		}
  		input:focus{
  			text-indent:0.12rem;  
  			line-height:0.26rem;			
  		}
  		input::placeholder{
  			text-align:left;
  			text-indent:0.12rem;
  			font-size:0.28rem;
  			color:#808080;
  		}
  	}
  	.feedbackBlank{
  		height:0.2rem;
  		background:#fff;
  	}
  	button{
  		border:none;
  		height:0.88rem;
  		width:7.1rem;
  		border-radius:0.08;
  		background:#e42031;
  		font-size:0.3rem;
  		color:#fff;
  	}
}
</style>